package com.qire.manhua.activity;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.qire.antscore.annotation.RouteMapping;
import com.qire.antsrouter.inject.Autowired;
import com.qire.common.constant.Navigation;
import com.qire.common.inject.EventControllerInjector;
import com.qire.common.inject.ViewModelInjector;
import com.qire.common.support.base.BaseActivity;
import com.qire.common.utils.ThemeUtil;
import com.qire.manhua.R;
import com.qire.manhua.controller.FriendPaidController;
import com.qire.manhua.databinding.ActivityFriendPaidBinding;
import com.qire.manhua.model.viewModel.impl.FriendPaidViewModel;

@RouteMapping(path = Navigation.Page.FriendPaidPage)
public class FriendPaidActivity extends BaseActivity<ActivityFriendPaidBinding> {

    @Autowired(injector = EventControllerInjector.class)
    FriendPaidController controller;

    @Autowired(injector = ViewModelInjector.class)
    FriendPaidViewModel viewModel;

    @Override
    public int layoutRid() {
        return R.layout.activity_friend_paid;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ThemeUtil.changeStatusBarLightOrDark(this, true, true);

        viewModel.onAddition(controller);
        controller.onAddition(viewModel);

        viewModel.loadData();
    }

    @Override
    public void finish() {
        if(viewModel.isPaidVisible()){
            viewModel.refreshWaresUI();
            return;
        }
        super.finish();
    }

}
